package bestbuy;
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);
	private static Factory factory;
	private static PurchaseItem newItem = null;
	
	public static void main(String[] args) {
		
		String choice = "y";
		while (choice.equals("y")) {
			programLoop();
			System.out.println();
			System.out.println("Would you like to continue? ('y','n')");
			sc.nextLine();
			choice = sc.nextLine();
		}
		
		}
		public static void programLoop() {
			/*ReceiptInterface test = new Rebate(new SecondaryHeader(new Receipt(),"Happy Holidays!"));
			System.out.println(test.getReceipt());*/
			
			int choice=0;
			while (choice < 1 || choice > 3) {
				System.out.println("1. Start New Receipt");
				System.out.println("2. Add Sales Item");
				System.out.println("3. Display Receipt");
				choice = sc.nextInt();
			}
			if (choice==1) {}
			if (choice==2) { //right now only has ability to add one item
				sc.nextLine();
				System.out.println("What is the item name?");
				String itemName = sc.nextLine();
				System.out.println("How much did it cost?");
				double cost = sc.nextDouble();
				System.out.println("How many did you buy?");
				int quantity = sc.nextInt();
				newItem = new PurchaseItem(itemName, cost, quantity);
			}
			if (choice==3) {
				if(newItem!=null)
					factory = new Factory(newItem);
				else
					factory = new Factory();
			}
		}
}
